﻿using MODEL;

namespace DAL
{
    public class LoginDAL
    {
        public LoginDAL(Mycontent db)
        {
            Db = db;
        }

        public Mycontent Db { get; }

        public int addLogin(Login g)
        {
            bool list=Db.Login.Any(x=>x.Lname == g.Lname);
            if (list)
            {
                return -2;
            }
            else
            {
                Db.Login.Add(g);
                return Db.SaveChanges();
            }
           
        }
        public Login Logins(string Lname,string Lpwd)
        {
            var list=Db.Login.Where(x=>x.Lname==Lname && x.Lpwd== Lpwd).FirstOrDefault();
            return list;
          
        }
    }
}